import request from '@/utils/request'

// 查询接口列表
export function listApi(query) {
  return request({
    url: '/thirdparty/api/list',
    method: 'get',
    params: query
  })
}

// 查询接口详细
export function getApi(apiId) {
  return request({
    url: '/thirdparty/api/' + apiId,
    method: 'get'
  })
}

// 新增接口
export function addApi(data) {
  return request({
    url: '/thirdparty/api',
    method: 'post',
    data: data
  })
}

// 修改接口
export function updateApi(data) {
  return request({
    url: '/thirdparty/api',
    method: 'put',
    data: data
  })
}

// 删除接口
export function delApi(apiId) {
  return request({
    url: '/thirdparty/api/' + apiId,
    method: 'delete'
  })
}

// 导出接口
export function exportApi(query) {
  return request({
    url: '/thirdparty/api/export',
    method: 'get',
    params: query
  })
}

// 测试接口
export function testApi(apiId) {
  return request({
    url: '/thirdparty/api/test/' + apiId,
    method: 'get'
  })
}

// 获取接口统计概览
export function getApiOverview() {
  return request({
    url: '/thirdparty/api/overview',
    method: 'get'
  })
}

// 获取接口调用趋势
export function getApiCallTrend(query) {
  return request({
    url: '/thirdparty/api/trend',
    method: 'get',
    params: query
  })
}

// 查询白名单列表
export function listWhitelist(query) {
  return request({
    url: '/thirdparty/whitelist/list',
    method: 'get',
    params: query
  })
}

// 新增白名单
export function addWhitelist(data) {
  return request({
    url: '/thirdparty/whitelist',
    method: 'post',
    data: data
  })
}

// 修改白名单
export function updateWhitelist(data) {
  return request({
    url: '/thirdparty/whitelist',
    method: 'put',
    data: data
  })
}

// 删除白名单
export function delWhitelist(whitelistId) {
  return request({
    url: '/thirdparty/whitelist/' + whitelistId,
    method: 'delete'
  })
}

// 导出白名单
export function exportWhitelist(query) {
  return request({
    url: '/thirdparty/whitelist/export',
    method: 'get',
    params: query
  })
}

// 获取接口监控数据
export function getApiMonitorData(query) {
  return request({
    url: '/thirdparty/monitor/data',
    method: 'get',
    params: query
  })
}

// 获取接口健康状态
export function getApiHealthStatus() {
  return request({
    url: '/thirdparty/monitor/health',
    method: 'get'
  })
}